"""
Used to generate random but short UUIDs. Since the length of the UUID is
reduced, the guarantee of randomness is reduced. The length of the UUID is 23

Author: Ugonna Nwakama
"""
import uuid

def suuid(oid=None):
	"""suuid(oid) -> string\n
Generates a short UUID.
If oid is None, it generates a version 4 random UUID.
If oid is not None, a version 3 UUID from oid is generated"""

	if oid:
		# Generates a version 3 UUID from an object identifier
		return str(uuid.uuid3(uuid.NAMESPACE_OID, oid))[0:23]
	else:
		# Generates a version 4 pseudorandom UUID
		return str(uuid.uuid4())[0:23]
